import { _decorator, Component, Node } from 'cc';
import { audioManager } from '../../ccc3-framework-core/framework/modules/audioManager';
import { BaseObject } from '../../ccc3-framework-core/framework/modules/baseObject';
import { entityUtil } from '../../ccc3-framework-core/framework/modules/entityUtil';
import { memoryConfig } from '../../ccc3-framework-core/framework/modules/memoryConfig';
import { uiManager } from '../../ccc3-framework-core/framework/modules/uiManager';
import { platformConf } from '../../ccc3-framework-core/platform/platformConf';
import { platformUtil } from '../../ccc3-framework-core/platform/platformUtil';
import Common from '../../ccc3-framework-core/utils/Common';
import { formDefine } from '../CustomDefine';
const { ccclass, property } = _decorator;

@ccclass('gameBack')
export class gameBack extends BaseObject {

    start() {
        this.bindTouchEnd(this.node, this.onBackHome);
    }
    private onBackHome() {
        platformUtil.currentPlatform.stopRecord((res) => {
            if (res == false) {
                console.log("不是抖音，不分享");
            }
            else if (res) {
                // uiManager.pushUIForm(pathDefine.formDir + formDefine.shareForm, (formNode) => {
                //     formNode.getComponent(shareForm).init();
                // }, BundlesDefine.main);
            }
        });
        audioManager.stopMusic();
        entityUtil.hideAllEntity(`level${Common.padLeft("" + (memoryConfig.instance.level + 1), 2, "0")}`, true);
        uiManager.hideUIForm(formDefine.gameForm);
        uiManager.hideUIForm(formDefine.EndForm);
        uiManager.pushUIForm(formDefine.homeForm);
    }

    update(deltaTime: number) {

    }
}

